Make sure that you are in the correct environment. To check your current environment, type the following. The environment you are in will have a star next to it.
conda info --envs
If you are not in the ee-python environment, you can switch into it using
source activate ee-python
In [12]:
# Import the Earth Engine Python Package into Python environment.
import ee
# Initialize the Earth Engine object, using the authentication credentials.
ee.Initialize()
# Print the information for an image asset.
image = ee.Image('srtm90_v4')
print(image.getInfo())
#celebrate!!
In [5]:
from IPython.display import Image
Image(url=image.getThumbUrl({'min':0, 'max': 3000}))
Out[5]:
In [6]:
from geopandas import GeoDataFrame
from shapely.geometry import shape
def fc2df(fc):
# Convert a FeatureCollection into a pandas DataFrame
# Features is a list of dict with the output
features = fc.getInfo()['features']
dictarr = []
for f in features:
# Store all attributes in a dict
attr = f['properties']
# and treat geometry separately
attr['geometry'] = f['geometry'] # GeoJSON Feature!b
# attr['geometrytype'] = f['geometry']['type']
dictarr.append(attr)
df = GeoDataFrame(dictarr)
# Convert GeoJSON features to shape
df['geometry'] = map(lambda s: shape(s), df.geometry)
return df
# End fc2df
In [8]:
fc = ee.FeatureCollection("ft:1KLL3aOt7-mavHuL_uyLLPXOf7vUVk6v08XbzIepq");
In [14]:
#!/usr/bin/env python
#"""Select rows from a fusion table."""
import ImageTk
import Image
ee.mapclient.centerMap(-93, 40, 4)
# Select the 'Sonoran desert' feature from the TNC Ecoregions fusion table.
fc = (ee.FeatureCollection('ft:1Ec8IWsP8asxN-ywSqgXWMuBaxI6pPaeh6hC64lA')
.filter(ee.Filter().eq('ECO_NAME', 'Sonoran desert')))
# Paint it into a blank image.
image1 = ee.Image(0).mask(0)